package com.study.test.demo.factory.simpleFactory;

import com.study.test.demo.factory.ICourse;

import java.util.Objects;

/**
 * 简单工厂-课程工厂:主要解决产品的创建
 *
 * @Author hupengming
 * @ClassName CourseFactory
 * @Date 2023-03-02  16:55
 * @Version 1.0
 */
public class CourseFactory {

    public ICourse create(Class<? extends ICourse> clazz) {
        try{
            if(Objects.nonNull(clazz)){
                return clazz.newInstance();
            }
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

}
